package com.jcj.jcjsharding.config;

import com.jcj.jcjsharding.datasource.ShardingDataSource;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * sharding 自动配置
 */
@Configuration
@EnableConfigurationProperties(ShardingProperites.class)
public class ShardingAutoConfiguration {
    @Bean
    public ShardingDataSource shardingDataSource(ShardingProperites properties) {
        //调用创建数据源
        return new ShardingDataSource(properties);
    }
}
